<template>
	<slot :controller="controller" :store="store" :model="model">
		<AppForm
			ref="editForm"
			v-bind="$attrs"
			:id="controlID"
			:name="model.codeName"
			:class="classNames"
			:data="store.data"
		>
			<AppAnchor
				v-if="store.anchorData.length > 0"
				:controlID="controlID"
				:anchorData="store.anchorData"
			/>
			<div class="control-content app-control-form__content">
				<AppRow :layoutOpts="{ selfLayout: 'TABLE_24COL' }">
					<AppCol
						noRoot
						:visible="store.detailModel.group1.visible"
						:layoutOpts="{
							selfLayout: 'TABLE_24COL',
							parentLayout: 'TABLE_24COL',
							colMD: 24,
						}"
					>
						<template #default="{ slotClass, slotStyle }">
							<slot
								name="group1"
								:controller="controller"
								:store="store"
								:model="model"
								:slotClass="slotClass"
								:slotStyle="slotStyle"
								:actions="{ handleComponentAction }"
							>
								<AppFormGroup
									name="group1"
									v-show="store.detailModel.group1.visible"
									:slotClass="slotClass"
									:slotStyle="slotStyle"
									:layoutOpts="{
										selfLayout: 'TABLE_24COL',
										parentLayout: 'TABLE_24COL',
										colMD: 24,
									}"
									:title="
										$t(
											'CONTROL.DEFORM.SYS_DEPLOY_SYSTEM.MAIN.GROUPPANEL.GROUP1',
											'系统基本信息'
										)
									"
									subCaption=""
									:enableAnchor="false"
									:showMoreItems="store.detailModel.group1.showMoreItems"
									:showMoreMode="store.detailModel.group1.showMoreMode"
									:infoGroupMode="false"
									:titleBarCloseMode="0"
									:showCaption="false"
									:uIActionGroup="store.detailModel.group1.uIActionGroup"
									@component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }"
								>
									<AppCol
										noRoot
										:visible="store.detailModel.id.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 12,
											colMD: 12,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="id"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="id"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="系统标识"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.id.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="idEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppInput
																v-bind="{ editorType: 'TEXTBOX' }"
																type="text"
																style=""
																name="id"
																:isDebounce="false"
																:disabled="store.detailModel.id.disabled"
																:value="store.data.id"
																@component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.system_id.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 12,
											colMD: 12,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="system_id"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="system_id"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="系统名"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.system_id.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="system_idEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppInput
																v-bind="{ editorType: 'TEXTBOX' }"
																type="text"
																style=""
																name="system_id"
																:isDebounce="false"
																:disabled="store.detailModel.system_id.disabled"
																:value="store.data.system_id"
																@component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.display_name.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 12,
											colMD: 12,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="display_name"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="display_name"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="系统显示名称"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.display_name.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="display_nameEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppInput
																v-bind="{ editorType: 'TEXTBOX' }"
																type="text"
																style=""
																name="display_name"
																:isDebounce="false"
																:disabled="
																	store.detailModel.display_name.disabled
																"
																:value="store.data.display_name"
																@component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.binding_id.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 12,
											colMD: 12,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="binding_id"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="binding_id"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="绑定标识"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.binding_id.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="binding_idEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppInput
																v-bind="{ editorType: 'TEXTBOX' }"
																type="text"
																style=""
																name="binding_id"
																:isDebounce="false"
																:disabled="
																	store.detailModel.binding_id.disabled
																"
																:value="store.data.binding_id"
																@component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.description.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 24,
											colMD: 24,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="description"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="description"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													label="描述"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.description.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="descriptionEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppInput
																v-bind="{ editorType: 'TEXTAREA' }"
																type="textarea"
																style="height: 70px"
																name="description"
																:isDebounce="false"
																:disabled="
																	store.detailModel.description.disabled
																"
																:value="store.data.description"
																@component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.create_time.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 12,
											colMD: 12,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="create_time"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="create_time"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													:label="$t('DEF.LNAME.CREATE_TIME', '创建时间')"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.create_time.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="create_timeEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSpan
																:context="store.context"
																:viewParams="store.viewParams"
																:dataType="5"
																v-bind="{ editorType: 'SPAN' }"
																deMajorField=""
																valueFormat="YYYY-MM-DD HH:mm:ss"
																editorType="SPAN"
																style=""
																name="create_time"
																noValueShowMode="STYLE1"
																:value="store.data.create_time"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
									<AppCol
										noRoot
										:visible="store.detailModel.update_time.visible"
										:layoutOpts="{
											parentLayout: 'TABLE_24COL',
											colLG: 12,
											colMD: 12,
										}"
									>
										<template v-slot:default="{ slotStyle, slotClass }">
											<slot
												name="update_time"
												:controller="controller"
												:store="store"
												:model="model"
												:slotClass="slotClass"
												:slotStyle="slotStyle"
												:actions="{ handleComponentAction }"
											>
												<AppFormItem
													name="update_time"
													:slotStyle="slotStyle"
													:slotClass="slotClass"
													:label="$t('DEF.LNAME.UPDATE_TIME', '最后更新时间')"
													labelPos="LEFT"
													:labelWidth="130"
													:showLabel="true"
													:enableAnchor="false"
													:rules="store.detailModel.update_time.valueRule"
													:emptyCaption="false"
												>
													<div class="form-editor-container">
														<slot
															name="update_timeEditor"
															:controller="controller"
															:store="store"
															:model="model"
															:actions="{ handleComponentAction }"
														>
															<AppSpan
																:context="store.context"
																:viewParams="store.viewParams"
																:dataType="5"
																v-bind="{ editorType: 'SPAN' }"
																deMajorField=""
																valueFormat="YYYY-MM-DD HH:mm:ss"
																editorType="SPAN"
																style=""
																name="update_time"
																noValueShowMode="STYLE1"
																:value="store.data.update_time"
															/>
														</slot>
													</div>
												</AppFormItem>
											</slot>
										</template>
									</AppCol>
								</AppFormGroup>
							</slot>
						</template>
					</AppCol>
				</AppRow>
			</div>
		</AppForm>
	</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{spinalCase ctrl.codeName}}-form-base.vue.hbs生成

import { Ref } from 'vue';
import { AppAnchor } from '@components/common/anchor';
import { AppCol } from '@/components/common/col';
import { AppRow } from '@/components/common/row';
import {
	AppForm,
	AppFormPage,
	AppFormGroup,
	AppFormTabPage,
	AppFormItem,
	AppFormButton,
	AppFormDruipart,
	AppFormIframe,
	AppFormRaw,
	AppFormMdCtrl,
	AppFormMdCtrlRepeater,
} from '@components/widgets/form';
import {
	IEvent,
	EditFormActionType,
	IEditFormAbility,
	IEditFormStore,
	IParam,
} from '@/core';
import { useProps, useBasic, useAction, useController } from './main-form-hook';

const editForm: Ref = ref(null);

// 输入参数
const props = defineProps(useProps());

// 基础数据
const {
	controlID,
	getClassNames,
	model,
	useNavParamsBind,
	useEventBind,
	handleActionClick,
	handleComponentAction,
} = useBasic(props);

const emit = defineEmits<{
	(
		event: 'ctrl-action',
		name: string,
		action: EditFormActionType,
		data: IParam[]
	): void;
	(event: 'ctrl-init', name: string, data: IEditFormAbility): void;
	(event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
	return getClassNames(props);
});

//  表单控制器
const controller = useController(props, evt, { controlID, editForm });

useNavParamsBind(controller, props);

const store: IEditFormStore = controller.getStore();

const ctrlService = controller.getCtrlService();

onMounted(() => {
	controller.ctrlMounted();
});
onUnmounted(() => {
	controller.ctrlDestroy();
});
</script>
